<?php
class MY_Controller extends Controller {

       function __construct()
       {
            parent::Controller();
			$this->load->helper('url');     //载入URL辅助函数

			//判断管理员是否登录
			if(!isset($_SESSION)){//判断是否开启session
				session_start();
			} 
			if(!isset($_SESSION['admin_info'])) {//判断是否登陆
				$error['detail']="对不起，您还没有登录！正在转向登陆页...";
				$error['min']=3;
				$error['url']=base_url()."manage/login";
				$this->load->view('manage/errormsg_view',$error);
			}
       }

		//地区分站权限检查
	   function ck_right($table,$id){
		   if($_SESSION['admin_info']['user_type']==0){
				return 0;	//如果是高级管理员，则直接返回0
		   }else{
				$this->load->model('cp_model');
				if($this->cp_model->get_areacode($table,$id)==$_SESSION['admin_info']['user_areacode']){
					return 0;	//如果地区匹配，则返回0
				}else{
					return 1;	//否则，返回1
				}
		   }
	   }

		

}
?>